//
// Created by Arikes on 9/25/21.
//

#ifndef DESIGNERMODE_COMMAND_H
#define DESIGNERMODE_COMMAND_H

#include <iostream>
namespace CommandMode
{
    class Command
    {
    public:
        virtual void execute() = 0;
    };

    class Receiver
    {
    public:
        void action()
        {
            std::cout<<"接收者的action()方法被调用..."<<std::endl;
        }
    };

    class ConcreteCommand:public Command
    {
    public:
        ConcreteCommand()
        {
            _receiver = new Receiver;
        }

        virtual void execute()
        {
            _receiver->action();
        }

    private:
        Receiver* _receiver = nullptr;
    };
}

#endif //DESIGNERMODE_COMMAND_H
